



function desinscription(){
	document.getElementById("desin_confirme").style.display = "block";
}

function changeProfesseur(nomProfesseur){
	alert(nomProfesseur+"est selectionner \n changement de professeur pour le cours");
}

function montre(id)
{
	var d = document.getElementById(id);
	if (d)
	{
		document.getElementById(id).style.display='block';
		
	}
}

function cache(id)
{
	var d = document.getElementById(id);
	if (d)
	{
		document.getElementById(id).style.display='none';	
	}
}



function sendForm(formulaire){
  var form = dojo.byId(formulaire);  
  var xhrArgs = {
      form: dojo.byId(formulaire),
      handleAs: "text",
      load: function(data){
        dojo.byId("response").innerHTML = data;
        dojo.byId(formulaire).reset();
        dojo.byId("contenu_page_i").style.display = "none";
      },
      error: function(error){
        // We'll 404 in the demo, but that's okay.  We don't have a 'postIt' service on the
        // docs server.
        dojo.byId("response").innerHTML = "Form posted.";
      }
    }
    // Call the asynchronous xhrPost
    dojo.byId("response").innerHTML = "Form being sent..."
    var deferred = dojo.xhrPost(xhrArgs); 
  
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Fonction permettant d'instancier l'objet XMLHttpRequest
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function getRequeteHttp()
{
var requeteHttp;
if (window.XMLHttpRequest) //Mozilla
      {
      requeteHttp=new XMLHttpRequest();
      if (requeteHttp.overrideMimeType) //Firefox
              {
              requeteHttp.overrideMimeType('text/xml');
              }
      }
      else
      {
      if (window.ActiveXObject) //IE < 7
              {
              try
                      {
                      requeteHttp=new ActiveXObject("Msxml2.XMLHTTP");
                      }
              catch(e)
                      {
                      try
                              {
                              requeteHttp=new ActiveXObject("Microsoft.XMLHTTP");
                              }
                      catch(e)
                              {
                              requeteHttp=null;
                              alert ("Navigateur incompatible");
                              }
                      }
              }
      }
return requeteHttp;
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Fonction permettant de faire un appel Ajax
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function modifCours(idcours){
  var requeteHttp=getRequeteHttp();
  if (requeteHttp!=null)
          {
          requeteHttp.open("POST","../orm/coursModif.php",true);
          requeteHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
          requeteHttp.onreadystatechange = function () {recevoirReponseRequeteAjax(requeteHttp)};
          requeteHttp.send('cours_id='+idcours+'&jours='+document.getElementById("jour"+idcours).value+'&heure='+document.getElementById("heure"+idcours).value+'&professeur='+document.getElementById("professeur"+idcours).value );
          }
  }

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Fonction permettant de recevoir et de traiter la reponse de la requete Ajax
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function recevoirReponseRequeteAjax(requeteHttp)
{
if (requeteHttp.readyState==4)
{
  if (requeteHttp.status==200)
  {
           if(requeteHttp.responseText){
        	   dojo.byId("response").innerHTML = requeteHttp.responseText ;
           }
  }
  else
          alert("Erreur requete");
}
}


function deleteProf(idProf){
	  var requeteHttp=getRequeteHttp();
	  if (requeteHttp!=null)
	          {
	          requeteHttp.open("POST","../orm/suppProf.php",true);
	          requeteHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	          requeteHttp.onreadystatechange = function () {reponseProf(requeteHttp)};
	          requeteHttp.send('ad_id='+idProf);
	          }
	  }

function reponseProf(requeteHttp)
{
if (requeteHttp.readyState==4)
{
  if (requeteHttp.status==200)
  {
           if(requeteHttp.responseText){
        	   dojo.byId("response").innerHTML = "Professeur supprimer.";
           }
  }
  else
          alert("Erreur requete");
}
}

function modifAdherent(ad_id){
	 var requeteHttp=getRequeteHttp();
	  if (requeteHttp!=null)
	          {
	          requeteHttp.open("POST","../orm/adhModif.php",true);
	          requeteHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	          requeteHttp.onreadystatechange = function () {recevoirReponseRequeteAjax(requeteHttp)};
	          requeteHttp.send('ad_id='+ad_id+'&ad_actif='+document.getElementById('actif'+ad_id).value);
	          }

}